#include <bits/stdc++.h>
using namespace std;

signed main() {
	freopen("op.in", "r", stdin);
	freopen("op.out", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr int mod=1e9+7;
	int x,y;
	cin>>x>>y;
	vector<int> f(y<<1|1);
	f[x]=1;
	auto Mod=[](int x) {
		return x>=mod?x-mod:x;
	};
	for(int i=x+1;i<=y;++i) {
		f[i]=Mod(f[i-1]+(i&1^1)*f[i>>1]);
	}
	cout<<f[y];
	return 0;
}

